package com.kh.first;

import org.apache.commons.lang3.StringUtils;

public class PojoGen {
    String oo = "11";
    public static void main(String[] args) {
//        test01();
        new PojoGen().fff();
    }
    public void fff(){
        new Thread(()->{
            System.out.println(this.oo);
        }).start();
    }

    private static void test01() {
        String sql = "`id` bigint(20) NOT NULL AUTO_INCREMENT,\n" +
                "  `dept` varchar(10) COLLATE utf8_bin DEFAULT NULL,\n" +
                "  `productionLine` varchar(20) COLLATE utf8_bin DEFAULT NULL,\n" +
                "  `packageNumber` varchar(20) COLLATE utf8_bin DEFAULT NULL,\n" +
                "  `createTime` datetime DEFAULT NULL,\n" +
                "  `schedulingNo` int(2) DEFAULT NULL,\n" +
                "  `schedulingCatagory` int(2) DEFAULT NULL,\n" +
                "  `startWorkTime` datetime DEFAULT NULL,\n" +
                "  `endWorkTime` datetime DEFAULT NULL,\n" +
                "  `extraHours` decimal(4,2) DEFAULT NULL,\n" +
                "  `semifinishedProductNo` int(4) DEFAULT NULL,\n" +
                "  `completeProductNo` int(4) DEFAULT NULL,\n" +
                "  `processLostNo` int(4) DEFAULT NULL,\n" +
                "  `materialLostNo` int(4) DEFAULT NULL,\n" +
                "  `no1WithStep1MaterialLostNo` int(3) DEFAULT NULL,\n" +
                "  `no1WithStep1ProcessLostNo` int(3) DEFAULT NULL,\n" +
                "  `no1WithStep1Reason` varchar(255) COLLATE utf8_bin DEFAULT NULL,\n" +
                "  `no1WithStep1` int(3) DEFAULT NULL COMMENT '白/夜班的第一行第一个两小时',\n" +
                "  `no1WithStep2` int(3) DEFAULT NULL,\n" +
                "  `no2ProcessLostNo` int(3) DEFAULT NULL,\n" +
                "  `no2MaterialLostNo` int(3) DEFAULT NULL,\n" +
                "  `no2Reason` varchar(255) COLLATE utf8_bin DEFAULT NULL,\n" +
                "  `no2` int(3) DEFAULT NULL COMMENT '休息完了，工作，然后就吃饭',\n" +
                "  `no3WithStep1` int(3) DEFAULT NULL COMMENT '吃完饭干活',\n" +
                "  `no3WithStep2` int(3) DEFAULT NULL,\n" +
                "  `no4WithStep1` int(3) DEFAULT NULL COMMENT '接近尾声的干活',\n" +
                "  `no4WithStep2` int(3) DEFAULT NULL,\n" +
                "  `no1WithStep2MaterialLostNo` int(3) DEFAULT NULL,\n" +
                "  `no1WithStep2ProcessLostNo` int(3) DEFAULT NULL,\n" +
                "  `no1WithStep2Reason` varchar(255) COLLATE utf8_bin DEFAULT NULL,\n" +
                "  `no3WithStep1MaterialLostNo` int(3) DEFAULT NULL,\n" +
                "  `no3WithStep1ProcessLostNo` int(3) DEFAULT NULL,\n" +
                "  `no3WithStep1Reason` varchar(255) COLLATE utf8_bin DEFAULT NULL,\n" +
                "  `no3WithStep2MaterialLostNo` int(3) DEFAULT NULL,\n" +
                "  `no3WithStep2ProcessLostNo` int(3) DEFAULT NULL,\n" +
                "  `no3WithStep2Reason` varchar(255) COLLATE utf8_bin DEFAULT NULL,\n" +
                "  `no4WithStep1MaterialLostNo` int(3) DEFAULT NULL,\n" +
                "  `no4WithStep1ProcessLostNo` int(3) DEFAULT NULL,\n" +
                "  `no4WithStep1Reason` varchar(255) COLLATE utf8_bin DEFAULT NULL,\n" +
                "  `no4WithStep2MaterialLostNo` int(3) DEFAULT NULL,\n" +
                "  `no4WithStep2ProcessLostNo` int(3) DEFAULT NULL,\n" +
                "  `no4WithStep2Reason` varchar(255) COLLATE utf8_bin DEFAULT NULL,\n" +
                "  `status` int(2) DEFAULT NULL,\n" +
                "  `ioUser` varchar(255) COLLATE utf8_bin DEFAULT NULL,";

//        String cc = "<1> <2> <3>";
        String[] fields = StringUtils.substringsBetween(sql, "`", "` ");
        StringBuilder sb = new StringBuilder();
        for (String field : fields) {
            String f = String.format("private String %s;\n", field);
            sb.append(f);
        }
        System.out.println(sb.toString());
    }
}
